Suppose that we have stringvalue=125.32600 when it convert to decimal value with this code
decimal d;
decimal.tryparse(stringvalue,out d)
d value is 125.326 how can I do this convert with final result 125.32600
Home / DeveloperSection / Forums / How can I convert string to decimal with trailing zero(s)
Suppose that we have stringvalue=125.32600 when it convert to decimal value with this code
decimal d;
decimal.tryparse(stringvalue,out d)
d value is 125.326 how can I do this convert with final result 125.32600
Anonymous User
05-Oct-2013Your code works as written (as long as the decimal separator matches your culture):
Decimal already remembers how many trailing zeros it has. This is caused by decimal representing numbers in non-normalized form, with an integer mantissa and an exponent representing the number of decimal digits. e.g. 125.32600 is represented as 12532600 * 10^-5